proc parse_invite {from x} {

	set ifadm 0
	wrapper:splitxml $x tag vars isempty chdata children
	set tx $vars

	wrapper:splitxml $tag tag vars isempty chdata children
	if {[wrapper:getattr $vars xmlns]=="http://jabber.org/protocol/muc#user"} {
		wrapper:splitxml $children tag vars isempty chdata children
		wrapper:splitxml $tag tag vars isempty chdata children
		if {$tag=="invite"} {
			set fromjid [wrapper:getattr $vars from]
			#set fromlist [split $fromjid "@"]
			set conf [node_from_jid $fromjid]
			#set frmlist [split [lindex $fromlist 1] "/"]
			set serv [server_from_jid $fromjid]
			set nick [resource_from_jid $fromjid]
			set ifadm [ifadmin "$fromjid"]
			wrapper:splitxml $children tag vars isempty chdata children
			wrapper:splitxml $tag tag vars isempty chdata children
			if {$tag=="reason"} {
				set reason $chdata
			}
		} else {
			putlog "EXCEPTION: parse_invite"
			return
		}
		wrapper:splitxml $tx tag vars isempty chdata children
		if {$tag=="x"} {
			if {[wrapper:getattr $vars xmlns]=="jabber:x:conference"} {
				set cjid [wrapper:getattr $vars jid]
			}
		}
		hook::run incoming_invite "$from" "$fromjid" "$cjid" "$reason"
	}
	
}